function [X, Y, P, W, F] = syntheticDataGenerator (M, N)
%function to generate syntetic data to fit our model


    %interval for the X data
    MAXVAL_X = 50;
    MINVAL_X = 10;
    
    MAXVAL_W = 40;
    MINVAL_W = 0;

    %P parameters limits of optimization
    LB = [1, 7];
    WB = [1, 7];
    
    %generate source variables
    X = MINVAL_X + (MAXVAL_X - MINVAL_X) .* rand(M,N);
    
    %initialize P
    P = featureParametersInitialization(M, N, WB, LB);
    
    %initialize W
    W = MINVAL_W + (MAXVAL_W - MINVAL_W) .* rand(N+1,1);
    
    %feature scaling to avoid overflow
    [XS, mu, st] = featureScaling(X);
    
    DummyY = X(:,1);
    %calculate the features
    [FY F] = featureProgram(DummyY, XS, P);
    
    mF = size(F,1);
    
    %add the intercepet term
    F = [ones(mF,1), F];
    
    %make the linear prediction to be the Target variable
    %in this way the error will be zero (minimum for P and W)
    Y = F * W;
    
    padding = size(X,1) - size(Y,1);
    
    Y = padarray(Y,[padding 0],nan,'pre');
    
end

